{% extends "base.jinja2" %}
{%block main%}

<main>
  <div class="main-left scrollbar">
    <form action="" onsubmit="onSubmitCrackTask(event)">
      <div class="form-row">
        <label for="url">目标链接</label>
        <div class="hint-question-mark" title="存在可攻击参数的URL">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <input type="text" name="url" id="form-url" placeholder="http://example.com/aaa" />
      </div>
      <div class="form-row">
        <label for="method">请求方式</label>
        <div class="hint-question-mark" title="可攻击参数的请求方式，大写">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <input type="text" name="method" id="form-method" placeholder="POST" />
      </div>
      <div class="form-row">
        <label for="inputs">表单输入</label>
        <div class="hint-question-mark" title="可攻击的参数，用逗号分隔">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <input type="text" name="inputs" id="form-inputs" placeholder="name,user" />
      </div>
      <div class="form-row">
        <label for="interval">请求间隔</label>
        <div class="hint-question-mark" title="发送请求的间隔，单位为秒">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <input type="text" name="interval" id="form-interval" value="0.03" />
      </div>
      <div class="form-row">
        <label for="detect-mode">分析模式</label>
        <div class="hint-question-mark" title="影响payload的长度和生成速度">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <select name="detect-mode" id="form-detect-mode">
          <option value="accurate">精确</option>
          <option value="fast">快速</option>
        </select>
      </div>
      <div class="form-row">
        <label for="environment">模板环境</label>
        <div class="hint-question-mark" title="模板渲染的环境，决定最终payload可以使用什么全局变量">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <select name="environment" id="form-environment">
          <option value="jinja2">jinja内部</option>
          <option value="flask">flask内部</option>
        </select>
      </div>
      <div class="form-row">
        <label for="replaced_keyword_strategy">替换绕过</label>
        <div class="hint-question-mark" title="如何对待被替换的关键字">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <select name="replaced_keyword_strategy" id="form-replaced_keyword_strategy">
          <option value="avoid">避免使用被替换的关键字</option>
          <option value="doubletapping">对替换的关键字进行双写</option>
          <option value="ignore">忽略关键字被替换的事实</option>
        </select>
      </div>
      <div class="form-row">
        <label for="detect_waf_keywords">枚举waf关键字</label>
        <div class="hint-question-mark" title="是否枚举被waf的关键字，需要额外时间">
          <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M11.967 12.75C12.967 11.75 13.967 11.3546 13.967 10.25C13.967 9.14543 13.0716 8.25 11.967 8.25C11.0351 8.25 10.252 8.88739 10.03 9.75M11.967 15.75H11.977M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
              stroke-width="2" stroke-linecap="round" />
          </svg>
        </div>
        <select name="detect_waf_keywords" id="form-detect_waf_keywords">
          <option value="none">不枚举waf关键字</option>
          <option value="fast">快速枚举waf关键字</option>
          <option value="full">精细枚举waf关键字</option>
        </select>
      </div>
      <input type="hidden" name="type" value="crack" />
      <input type="hidden" name="action" value="" />
      <div class="form-row">
        <input type="submit" value="开始分析" />
      </div>
    </form>
  </div>
  {%include 'interactive-panel.jinja2'%}
</main>
{%endblock%}

{%block script%}
<script>
  function alertWrongInput(formData) {
    for (let key of ["url", "method", "inputs"]) {
      if (!formData.get(key)) {
        alert(`你的${key}没有填写！`);
        return false;
      }
    }
    return true;
  }
  function onSubmitCrackTask(event) {
    return onSubmitGeneralCrackPathTask(event, alertWrongInput)
  }
</script>
{%endblock%}